/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Oswl_C
 */
@Entity
@Table(name = "test", catalog = "lecturadb", schema = "")
@NamedQueries({
    @NamedQuery(name = "Test.findAll", query = "SELECT t FROM Test t"),
    @NamedQuery(name = "Test.findByTesCodigo", query = "SELECT t FROM Test t WHERE t.tesCodigo = :tesCodigo"),
    @NamedQuery(name = "Test.findByEjeCodigo", query = "SELECT t FROM Test t WHERE t.ejeCodigo = :ejeCodigo"),
    @NamedQuery(name = "Test.findByTesTitulo", query = "SELECT t FROM Test t WHERE t.tesTitulo = :tesTitulo"),
    @NamedQuery(name = "Test.findByTesTipo", query = "SELECT t FROM Test t WHERE t.tesTipo = :tesTipo")})
public class Test implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "TES_CODIGO")
    private Integer tesCodigo;
    @ManyToOne
    @JoinColumn(name="EJE_CODIGO")
    private Ejercicio ejeCodigo;
    @Column(name = "TES_TITULO")
    private String tesTitulo;
    @Lob
    @Column(name = "TES_DESCRI")
    private String tesDescri;
    @Column(name = "TES_TIPO")
    private Character tesTipo;

    public Test() {
    }

    public Test(Integer tesCodigo) {
        this.tesCodigo = tesCodigo;
    }

    public Integer getTesCodigo() {
        return tesCodigo;
    }

    public void setTesCodigo(Integer tesCodigo) {
        Integer oldTesCodigo = this.tesCodigo;
        this.tesCodigo = tesCodigo;
        changeSupport.firePropertyChange("tesCodigo", oldTesCodigo, tesCodigo);
    }

    public Ejercicio getEjeCodigo() {
        return ejeCodigo;
    }

    public void setEjeCodigo(Ejercicio ejeCodigo) {
        Ejercicio oldEjeCodigo = this.ejeCodigo;
        this.ejeCodigo = ejeCodigo;
        changeSupport.firePropertyChange("ejeCodigo", oldEjeCodigo, ejeCodigo);
    }

    public String getTesTitulo() {
        return tesTitulo;
    }

    public void setTesTitulo(String tesTitulo) {
        String oldTesTitulo = this.tesTitulo;
        this.tesTitulo = tesTitulo;
        changeSupport.firePropertyChange("tesTitulo", oldTesTitulo, tesTitulo);
    }

    public String getTesDescri() {
        return tesDescri;
    }

    public void setTesDescri(String tesDescri) {
        String oldTesDescri = this.tesDescri;
        this.tesDescri = tesDescri;
        changeSupport.firePropertyChange("tesDescri", oldTesDescri, tesDescri);
    }

    public Character getTesTipo() {
        return tesTipo;
    }

    public void setTesTipo(Character tesTipo) {
        Character oldTesTipo = this.tesTipo;
        this.tesTipo = tesTipo;
        changeSupport.firePropertyChange("tesTipo", oldTesTipo, tesTipo);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tesCodigo != null ? tesCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Test)) {
            return false;
        }
        Test other = (Test) object;
        if ((this.tesCodigo == null && other.tesCodigo != null) || (this.tesCodigo != null && !this.tesCodigo.equals(other.tesCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return tesTitulo;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
